package com.bng8.superstar_cms.domain.dto;

import com.bng8.superstar_cms.util.InsertValidationGroup;
import com.bng8.superstar_cms.util.UpdateValidationGroup;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * ClassName: SupUserDTO
 * Package: com.bng8.superstar_cms.domain.dto
 * Date: 2023/8/15 14:17
 * Author: 安知（13921877634）
 */
@Data
public class SupUserDTO implements Serializable {
    /**
     * serialVersionUID
     */
    private static final long serialVersionUID = 4172418217870878272L;

    /**
     * 主键ID
     */
    private Long id;

    /**
     * 用户名
     */
    @NotBlank(message = "用户名不能为空！",
            groups = {InsertValidationGroup.class})
    @Length(min = 4, max = 20, message = "用户名长度不能少于4位！",
            groups = {InsertValidationGroup.class, UpdateValidationGroup.class})
    private String userName;

    /**
     * 密码
     */
    @NotBlank(message = "密码不能为空！",
            groups = {InsertValidationGroup.class})
    @Length(min = 6, max = 18,
            message = "密码长度不能少于6位，不能多于18位！",
            groups = {InsertValidationGroup.class, UpdateValidationGroup.class})
    private String password;

    /**
     * 用户昵称
     */
    private String nickName;

    /*@NotBlank(message = "手机号不能为空！",
            groups = {InsertValidationGroup.class})
    @Pattern(regexp = "^[1][3,4,5,6,7,8,9][0-9]{9}$", message = "手机号格式有误",
            groups = {InsertValidationGroup.class, UpdateValidationGroup.class})
    private String phone;*/

    /**
     * 邮箱
     */
    @Email(message = "必须为有效邮箱！",
            groups = {InsertValidationGroup.class, UpdateValidationGroup.class})
    private String email;

    /**
     * 挑战者信息
     */
    private SupChallengerDTO challenger;

    /**
     * 创建时间
     */
    private LocalDateTime gmtCreate;

}
